// dnSpy decompiler from Assembly-CSharp.dll class: SingletonPrefab
using System;
using System.Collections.Generic;
using UnityEngine;

public class SingletonPrefab : CheckedMonoBehaviour
{
	protected static T GetSingletonPrefabComponent<T>(string prefabName) where T : SingletonPrefab
	{
		SingletonPrefab singletonPrefab = null;
		if (!SingletonPrefab.prefabs.TryGetValue(typeof(T), out singletonPrefab))
		{
			GameObject gameObject = Resources.Load(prefabName) as GameObject;
			if (null == gameObject)
			{
				UnityEngine.Debug.LogError("Prefab '" + prefabName + "' has not been found in Resources folder!");
			}
			singletonPrefab = gameObject.GetComponent<T>();
			if (null == singletonPrefab)
			{
				UnityEngine.Debug.LogError("No '" + typeof(T).Name + "' component is attached to prefab 'Rules'!");
			}
			SingletonPrefab.prefabs[typeof(T)] = singletonPrefab;
			singletonPrefab.InitCheckedMonoBehaviour();
		}
		return singletonPrefab as T;
	}

	private static Dictionary<Type, SingletonPrefab> prefabs = new Dictionary<Type, SingletonPrefab>();
}
